package com.example.rabbitmqstudy.topic;

import com.example.rabbitmqstudy.utils.RabbitMQUtils;
import com.rabbitmq.client.BuiltinExchangeType;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

public class Send {

    public static void main(String[] args) throws IOException, TimeoutException {
        Connection connection = RabbitMQUtils.getConnection();
        Channel channel = connection.createChannel();

        channel.exchangeDeclare(Data.EXCHANGE_NAME, BuiltinExchangeType.TOPIC);
        channel.basicPublish(Data.EXCHANGE_NAME, Data.TOPIC_NAME, null, "测试topic模式".getBytes());

        channel.close();
        connection.close();
    }
}
